package structures;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import pack.MyReader;

public class CardDriverActivity extends ElementaryFile{
	
	public final int activityPointerOldestDayRecord; //Int (0..CardActivityLengthRange-1)
	public final int activityPointerNewestRecord; //Int (0..CardActivityLengthRange-1)
	public final List<CardActivityDailyRecord> activityDailyRecords = new ArrayList<CardActivityDailyRecord>();
	
	public CardDriverActivity(MyReader reader, int cardActvityLengthRange, int length)
	{
		activityPointerOldestDayRecord = reader.readInt(2);
		activityPointerNewestRecord = reader.readInt(2);
		byte[] b = reader.read(length-4);
		int oldest, newest, from, to;
		
		oldest = activityPointerOldestDayRecord;
		newest = activityPointerNewestRecord;
		
//		byte[] valueInOrder;
//		if(oldest < newest){
//			valueInOrder = Arrays.copyOfRange(b, oldest, newest + CardActivityDailyRecord.size);
//		}
//		else{
//			byte[] first = Arrays.copyOfRange(b, 0, newest + CardActivityDailyRecord.size);
//			byte[] last = Arrays.copyOfRange(b, oldest, b.length);
//			
//			valueInOrder = new byte[first.length + last.length];
//			System.arraycopy(first, 0, valueInOrder, 0, first.length);
//			System.arraycopy(last, 0, valueInOrder, first.length, last.length);
//		}
//		
//		int n = valueInOrder.length / CardActivityDailyRecord.size;
//		for(int i = 0 ; i < n ; i++){
//			activityDailyRecords.add(new CardActivityDailyRecord(reader));
//		}
	}
}
